﻿
-- ================================================
-- Remarks: 
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'Ivy_SiteGeneralBasic_Feedbacks_GetAllContactRequest')
	BEGIN
		DROP  Procedure  Ivy_SiteGeneralBasic_Feedbacks_GetAllContactRequest
	END

GO

CREATE PROCEDURE [Ivy_SiteGeneralBasic_Feedbacks_GetAllContactRequest]
-- =============================================
-- Author:		<Ram pravesh kr>
-- Create date: <16-12-2015>
-- Description:	<Ivy_FeedbackDetails_GetAll>
-- =============================================
-- Add the parameters for the stored procedure here
	(
				@Sys_IsDeleted int = 0,
				@Sys_OrganizationID int = -1
	)

AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT OFF;

	SELECT	[Feedback].[FeedbackKey], 
			[Feedback].[FeedbackUserKey], 
			[Feedback].[FeedbackSubject],
			[Feedback].[FeedbackText], 
			[Feedback].[FeedbackDate], 
			[FeedbackUser].[FeedbackUserKey], 
			[FeedbackUser].[FeedbackUserName], 
            [FeedbackUser].[FeedbackUserEmail], 
			[FeedbackUser].[RegisteredUserKey]
	FROM	[Feedback] INNER JOIN [FeedbackUser] 
	ON		[Feedback].[FeedbackUserKey] = [FeedbackUser].[FeedbackUserKey]
	WHERE	(
				(([Feedback].[Sys_IsDeleted] = @Sys_IsDeleted) AND 
				([Feedback].[Sys_OrganizationID] = @Sys_OrganizationID)) AND 
				([Feedback].[FeedbackSubject] = 'Contact Request')
			)
	ORDER BY	[Feedback].[Sys_DateOfCreation];

END
GO
